package com.roadmap.client.module.task;

import java.util.Date;

import org.apache.log4j.Logger;

import com.roadmap.client.common.SimpleResult;
import com.roadmap.common.BaseUtility;
import com.roadmap.common.RdcLogger;
import com.roadmap.entities.LifeTask;

/** this class includes a task and the dates which the task will be executed on */
public class TaskResult extends SimpleResult {
	private final static Logger logger = RdcLogger.getLogger(TaskResult.class);
	private LifeTask task;
	private Date[] dates;
	private String planName;

	// private int realProgress;
	// private int idealProgress;

	public TaskResult(LifeTask task, Date[] dates) {
		this.task = task;
		this.dates = dates;
	}

	public LifeTask getTask() {
		return task;
	}

	public Date[] getDates() {
		return dates;
	}

	public void setDates(Date[] dates) {
		this.dates = dates;
	}

	public String getPlanName() {
		return planName;
	}

	// public int getRealProgress() {
	// return realProgress;
	// }
	//
	// public void setRealProgress(int realProgress) {
	// this.realProgress = realProgress;
	// }
	//
	// public int getIdealProgress() {
	// return idealProgress;
	// }
	//
	// public void setIdealProgress(int idealProgress) {
	// this.idealProgress = idealProgress;
	// }

	public void setPlanName(String planName) {
		this.planName = planName;
	}

	/** this method is just for debugging */
	public void printInfo() {
		if (task != null) {
			logger.info("task's ID is : " + task.getId());
			logger.info("the task's plan is: " + planName);
			logger.info(" task's execute cycle (every N days) N: "
					+ task.getExecuteCycle());
			// logger.info("the task's ideal progress: " + idealProgress);
			// logger.info("the task's real progress:" + realProgress);
		}

		if (dates != null) {
			logger.info("the dates on which the task should be executed.");
			for (int i = 0; i < dates.length; i++) {
				logger.info(" executing date: "
						+ BaseUtility.formatDate(dates[i]));
			}
		}
	}
}
